<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta content="telephone=no" name="format-detection" />
    <!-- 留作将来统一添加 -->
    <TEMPLATE>${TEMPLATE}</TEMPLATE>
    <title>个人报告-学生</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/index.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style type="text/css">
        body {
            background: rgba(90, 194, 255, 1);
        }
        
        .wrapper {
            padding: 4px 15px;
        }
        
        .select {
            z-index: 1;
            position: relative;
            height: 50px;
            background: rgba(255, 255, 255, 1);
            box-shadow: 0px 4px 10px 0px rgba(0, 135, 214, 0.37);
            border-radius: 10px;
            padding: 10px 0;
            overflow: visible;
        }
        
        .select-item {
            min-width: 50%;
            height: 30px;
            border-right: 1px solid #bfbfbf;
        }
        
        .select-item:last-of-type {
            border-right: 0;
        }
        
        .select-item-txt {
            font-weight: bold;
            color: rgba(25, 25, 25, 1);
            font-size: 15px;
        }
        
        .select-item-img {
            width: 16px;
            height: 16px;
            margin-left: 5px;
        }
        
        .layer {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
        }
        
        .downdrop {
            position: absolute;
            left: 0;
            top: 60px;
            width: 100%;
            padding: 0 11px;
            background: rgba(255, 255, 255, 1);
            border-radius: 10px;
        }
        
        .downdrop-item {
            height: 50px;
            border-bottom: 1px solid rgba(212, 212, 212, 1);
            border-right: 0;
        }
        
        .downdrop-item:last-of-type {
            border: 0;
        }
        
        .downdrop-item-txt {
            font-size: 15px;
            font-weight: 400;
            color: rgba(25, 25, 25, 1);
        }
        
        .downdrop-item-img {
            width: 17px;
            height: 17px;
        }
        
        .content {
            margin-top: 20px;
            padding: 22px 15px 31px 15px;
            background: rgba(255, 255, 255, 1);
            box-shadow: 0px 4px 10px 0px rgba(0, 135, 214, 0.37);
            border-radius: 10px;
        }
        
        .head {
            height: 20px;
            margin-bottom: 25px;
        }
        
        .head-txt {
            font-size: 13px;
            font-weight: 400;
            color: rgba(25, 25, 25, 1);
        }
        
        .cir1 {
            width: 14px;
            height: 14px;
            background: rgba(253, 155, 67, 1);
            border-radius: 50%;
            margin-right: 5px;
        }
        
        .cir2 {
            width: 14px;
            height: 14px;
            background: rgba(90, 194, 255, 1);
            border-radius: 50%;
            margin-right: 5px;
        }
        
        .row {
            margin-bottom: 20px;
        }
        
        .row:last-of-type {
            margin-bottom: 0;
        }
        
        .row-title {
            min-width: 39px;
            font-size: 13px;
            font-weight: bold;
            color: rgba(25, 25, 25, 1);
            margin-right: 10px;
        }
        
        .columnar-1 {
            height: 14px;
            background: linear-gradient(90deg, rgba(147, 227, 255, 1) 0%, rgba(90, 194, 255, 1) 100%);
            border-radius: 0px 100px 100px 0px;
        }
        
        .columnar-2 {
            height: 14px;
            background: linear-gradient(90deg, rgba(255, 207, 163, 1) 0%, rgba(253, 155, 67, 1) 100%);
            border-radius: 0px 100px 100px 0px;
        }
        
        .fraction {
            font-size: 12px;
            font-weight: 500;
            color: rgba(25, 25, 25, 1);
            width: 40px;
            text-align: right;
        }
        
        .active {
            color: rgba(90, 194, 255, 1) !important;
        }
    </style>
</head>

<body>
    <div class="vueApp" v-cloak>
        <div v-show="downdrop" class="layer"></div>
        <div class="wrapper">
            <div class="select" data-flex="main:justify">
                <div class="select-item" data-flex-box="1" @click="toggle(1)" data-flex="main:center cross:center">
                    <div class="select-item-txt" :class="{active: index === 1}">{{termTxt}}</div>
                    <img class="select-item-img" :src="arrow1" alt="">
                </div>
                <div class="select-item" data-flex-box="1" @click="toggle(2)" data-flex="main:center cross:center">
                    <div class="select-item-txt" :class="{active: index === 2}">{{unitTxt}}</div>
                    <img class="select-item-img" :src="arrow2" alt="">
                </div>
                <div v-show="index === 1" class="downdrop">
                    <div v-for="item,index in terms" class="downdrop-item" data-flex="main:justify cross:center" @click="toggleTerm(index)">
                        <div class="downdrop-item-txt">{{ item.txt }}</div>
                        <img class="downdrop-item-img" v-show="term === index" src="../../image/course/checked2.png" alt="">
                    </div>
                </div>
                <div v-show="index === 2" class="downdrop">
                    <div v-for="item,index in units" class="downdrop-item" data-flex="main:justify cross:center" @click="toggleUnit(index)">
                        <div class="downdrop-item-txt">{{ item.txt }}</div>
                        <img class="downdrop-item-img" v-show="unit === index" src="../../image/course/checked2.png" alt="">
                    </div>
                </div>
            </div>
            <div class="content">
                <div class="head" data-flex="main:left cross:center">
                    <div class="head-txt" data-flex-box="8">个人/班级对比图</div>
                    <div data-flex="cross:center main:right" data-flex-box="1">
                        <div class="cir1"></div>
                        <div class="head-txt">班级</div>
                    </div>
                    <div data-flex="cross:center main:right" data-flex-box="1">
                        <div class="cir2"></div>
                        <div class="head-txt">个人</div>
                    </div>
                </div>
                <div v-for="item,index in scores" class="row" data-flex="cross:center box:first">
                    <div class="row-title">{{ item.txt }}</div>
                    <div>
                        <div style="margin-bottom: 4px" data-flex="main:left cross:center">
                            <div :style="'width:' + item.score1 + '%'" class="columnar-1"></div>
                            <div class="fraction">{{item.score1}}分</div>
                        </div>
                        <div data-flex="main:left cross:center">
                            <div :style="'width:' + item.score2 + '%'" class="columnar-2"></div>
                            <div class="fraction">{{item.score2}}分</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    // html 的引号一律为双引号(""),js 为单引号('')
    var USER, $S, vm;
    apiready = function() {
        $S = SERVICE();
        USER = USER();
        console.log(JSON.stringify(api.pageParam) + '=====pageParam');
        fnInit();
    };
    fnInit();
    // 初始化
    function fnInit() {
        vm = new Vue({
            el: '.vueApp',
            data: {
                info: null,
                index: 0,
                prev: 0,
                downdrop: false,
                termTxt: '第一学期',
                unitTxt: '第一单元',
                term: 0,
                unit: 0,
                terms: [{
                    txt: '第一学期'
                }, {
                    txt: '第二学期'
                }, {
                    txt: '第三学期'
                }, {
                    txt: '第四学期'
                }],
                units: [{
                    txt: '第一单元'
                }, {
                    txt: '第二单元'
                }, {
                    txt: '第三单元'
                }, {
                    txt: '第四单元'
                }],
                scores: [{
                    txt: '听力题',
                    score1: 40,
                    score2: 70
                }, {
                    txt: '选择题',
                    score1: 45,
                    score2: 20
                }, {
                    txt: '排序题',
                    score1: 24,
                    score2: 65
                }, {
                    txt: '连线题',
                    score1: 76,
                    score2: 24
                }, {
                    txt: '填空题',
                    score1: 87,
                    score2: 67
                }, {
                    txt: '判断题',
                    score1: 34,
                    score2: 54
                }]
            },
            methods: {
                toggle: function(arg) {
                    // 判断当前点击的和上一次点击的是不是同一个元素
                    var isPrev = arg === this.prev ? true : false;
                    this.prev = arg;
                    if (isPrev) {
                        // 如果是就关闭
                        this.downdrop = false;
                        this.index = 0;
                        this.prev = 0;
                    } else {
                        // 如果不是就根据参数切换
                        this.downdrop = true;
                        this.index = arg;
                    }
                },
                toggleTerm: function(arg) {
                    this.term = arg;
                    this.termTxt = this.terms[arg].txt;
                },
                toggleUnit: function(arg) {
                    this.unit = arg;
                    this.unitTxt = this.units[arg].txt;
                }
            },
            computed: {
                arrow1: function() {
                    return this.index === 1 ? '../../image/course/arrow2.png' : '../../image/course/arrow.png'
                },
                arrow2: function() {
                    return this.index === 2 ? '../../image/course/arrow2.png' : '../../image/course/arrow.png'
                }
            }
        });
        getPageData();
    }

    function load() {
        getPageData('load');
        fnAddHeaderRefreshingEvent(function() { //设置下拉刷新
            getPageData('headerRefreshing');
        });

        fnAddFooterLoadingEvent(function() { // 设置上拉加载
            getPageData('load');
        });

    }

    // 获取页面数据
    function getPageData(sign) {
        if (sign == 'headerRefreshing') {
            vm.pageNo = 1;
        } else {
            vm.pageNo++;
        }
        var url = '';
        var params = {};
        var callback = function(data) {
            if (vm.pageNo == '1') {
                vm.listData = [];
            }
            var listData = data.listData;
            for (var i = 0; i < listData.length; i++) {
                var item = listData[i];

            }
            vm.listData = vm.listData.concat(data.listData);
            // status 为200时,只返回data
        };
        var error = function(res) {
            // status 不是200时,全部返回
            api.refreshHeaderLoadDone();
        };
        POST(url, params, callback, error);
    }

    // 点击item
    function handleItem(item) {

    }

    function handleRightBtn() {
        var params = {
            isBtn: false
        }
        fnOpenPublicWin('学期', 'classPages/55', params);
    }
</script>

</html>